VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmEmpleados 
   Caption         =   "Form1"
   ClientHeight    =   8775
   ClientLeft      =   60
   ClientTop       =   390
   ClientWidth     =   11085
   BeginProperty Font 
      Name            =   "Eras Bold ITC"
      Size            =   12
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   ScaleHeight     =   8775
   ScaleWidth      =   11085
   StartUpPosition =   3  'Windows Default
   WindowState     =   2  'Maximized
   Begin VB.PictureBox Picture1 
      Height          =   3015
      Left            =   10080
      ScaleHeight     =   2955
      ScaleWidth      =   3435
      TabIndex        =   24
      Top             =   2880
      Width           =   3495
      Begin VB.Image Image1 
         BorderStyle     =   1  'Fixed Single
         Height          =   3015
         Left            =   0
         Stretch         =   -1  'True
         Top             =   0
         Width           =   3495
      End
   End
   Begin MSComDlg.CommonDialog cd1 
      Left            =   360
      Top             =   5520
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
      Color           =   2
      DialogTitle     =   "Elija una foto"
      Filter          =   "Fotos | *.jpg;*.bmp"
      FontName        =   "Eras Bold ITC"
      FontSize        =   10
   End
   Begin VB.TextBox Text8 
      Height          =   405
      Left            =   3000
      TabIndex        =   22
      Text            =   "Text2"
      Top             =   7200
      Width           =   6255
   End
   Begin VB.CommandButton Command10 
      Caption         =   "Buscar"
      Height          =   400
      Left            =   9360
      TabIndex        =   20
      Top             =   2040
      Width           =   1095
   End
   Begin VB.CommandButton Command6 
      Caption         =   "Salir"
      Height          =   400
      Left            =   11280
      TabIndex        =   19
      Top             =   8760
      Width           =   1335
   End
   Begin VB.CommandButton Command5 
      Caption         =   "Eliminar"
      Height          =   400
      Left            =   9600
      TabIndex        =   18
      Top             =   8760
      Width           =   1335
   End
   Begin VB.CommandButton Command4 
      Caption         =   "Modificar"
      Height          =   400
      Left            =   8040
      TabIndex        =   17
      Top             =   8760
      Width           =   1335
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Cancelar"
      Height          =   400
      Left            =   6480
      TabIndex        =   16
      Top             =   8760
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "Guardar"
      Height          =   400
      Left            =   4920
      TabIndex        =   15
      Top             =   8760
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Nuevo"
      Height          =   400
      Left            =   3360
      TabIndex        =   14
      Top             =   8760
      Width           =   1335
   End
   Begin VB.TextBox Text7 
      Height          =   405
      Left            =   3000
      TabIndex        =   13
      Text            =   "Text2"
      Top             =   6360
      Width           =   6255
   End
   Begin VB.TextBox Text6 
      Height          =   405
      Left            =   5760
      TabIndex        =   11
      Text            =   "Text2"
      Top             =   5520
      Width           =   3495
   End
   Begin VB.TextBox Text5 
      Height          =   405
      Left            =   3000
      TabIndex        =   9
      Text            =   "Text2"
      Top             =   5520
      Width           =   2535
   End
   Begin VB.TextBox Text4 
      Height          =   405
      Left            =   3000
      TabIndex        =   7
      Text            =   "Text2"
      Top             =   4440
      Width           =   6255
   End
   Begin VB.TextBox Text3 
      Height          =   885
      Left            =   3000
      MultiLine       =   -1  'True
      ScrollBars      =   2  'Vertical
      TabIndex        =   5
      Text            =   "frmEmpleados.frx":0000
      Top             =   3000
      Width           =   6255
   End
   Begin VB.TextBox Text2 
      Height          =   405
      Left            =   3000
      TabIndex        =   3
      Text            =   "Text2"
      Top             =   2040
      Width           =   6255
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "Eras Bold ITC"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   9960
      TabIndex        =   1
      Top             =   960
      Width           =   1095
   End
   Begin VB.Label SkinLabel1 
      Height          =   375
      Left            =   7320
      TabIndex        =   0
      Top             =   960
      Width           =   2535
   End
   Begin VB.Label SkinLabel2 
      Height          =   375
      Left            =   3000
      TabIndex        =   2
      Top             =   1680
      Width           =   2535
   End
   Begin VB.Label SkinLabel3 
      Height          =   375
      Left            =   3000
      TabIndex        =   4
      Top             =   2640
      Width           =   2535
   End
   Begin VB.Label SkinLabel4 
      Height          =   375
      Left            =   3000
      TabIndex        =   6
      Top             =   4080
      Width           =   2535
   End
   Begin VB.Label SkinLabel5 
      Height          =   375
      Left            =   3000
      TabIndex        =   8
      Top             =   5160
      Width           =   2535
   End
   Begin VB.Label SkinLabel6 
      Height          =   375
      Left            =   5760
      TabIndex        =   10
      Top             =   5160
      Width           =   2535
   End
   Begin VB.Label SkinLabel7 
      Height          =   375
      Left            =   3000
      TabIndex        =   12
      Top             =   6000
      Width           =   2535
   End
   Begin VB.Label SkinLabel8 
      Height          =   375
      Left            =   3000
      TabIndex        =   21
      Top             =   6960
      Width           =   2535
   End
   Begin VB.Label SkinLabel9 
      Height          =   255
      Left            =   3000
      TabIndex        =   23
      Top             =   6720
      Width           =   2895
   End
End
Attribute VB_Name = "frmEmpleados"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim tabla As DAO.Recordset
Sub Buscar()
    tabla.Index = "primarykey"
    tabla.Seek "=", Text1.Text
    If Not tabla.NoMatch Then
        mostrar
        Bloquear False
        Botones 3
    End If
End Sub
Sub mostrar()
On Error Resume Next
    Text1.Text = tabla(0)
    Text2.Text = tabla(1)
    Text3.Text = tabla(2)
    Text4.Text = tabla(3)
    Text5.Text = tabla(4)
    Text6.Text = tabla(5)
    Text7.Text = tabla(6)
    Text8.Text = tabla(7)
End Sub
Sub Limpiar()
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    Text6.Text = ""
    Text7.Text = ""
    Text8.Text = ""
    Image1.Picture = LoadPicture()
End Sub
Sub Bloquear(es As Boolean)
    es = Not es
    Text1.Locked = es
    Text2.Locked = es
    Text3.Locked = es
    Text4.Locked = es
    Text5.Locked = es
    Text6.Locked = es
    Text7.Locked = es
    Text8.Locked = es
End Sub
Sub Guardar()
    tabla(0) = Text1.Text
    tabla(1) = Text2.Text
    tabla(2) = Text3.Text
    tabla(3) = Text4.Text
    tabla(4) = Text5.Text
    tabla(5) = Text6.Text
    tabla(6) = Text7.Text
    tabla(7) = Text8.Text
    
    
End Sub
Sub Botones(es As Integer)
    If es = 1 Then
        Command1.Enabled = True
        Command2.Enabled = False
        Command4.Enabled = False
        Command5.Enabled = False
    End If
    If es = 2 Then
        Command1.Enabled = False
        Command2.Enabled = True
        Command4.Enabled = False
        Command5.Enabled = False
    End If
    If es = 3 Then
        Command1.Enabled = False
        Command2.Enabled = False
        Command4.Enabled = True
        Command5.Enabled = True
    End If
        
End Sub
Sub Cancelar()
      Limpiar
      Botones 1
      Bloquear False
End Sub


Private Sub Command1_Click()
    Limpiar
    Bloquear True
    Botones 2
    Text2.SetFocus
    Text1.Text = AutoNumero("CODEMPLEADO", "EMPLEADOS")

End Sub

Private Sub Command10_Click()
    FrmBusqueda.CampoDefecto = "nombre"
    FrmBusqueda.tabla = "select *from [EMPLEADOS] where nombre <>'0'"
    FrmBusqueda.UnicoCampo = False
    FrmBusqueda.CampoResultado = "CODEMPLEADO"
    FrmBusqueda.Show vbModal
    Text1.Text = FrmBusqueda.Resultado
    Buscar
End Sub

Private Sub Command2_Click()
    Dim fso As New FileSystemObject
    rutafoto = App.Path & "\fotos"
    If Not fso.FolderExists(rutafoto) Then
        fso.CreateFolder rutafoto
    End If
    If Text7.Text <> "" And fso.FileExists(Text7.Text) Then
        fso.CopyFile Text7.Text, rutafoto & "\" & Text1.Text & "emp" & ".jpg"
        Text7.Text = rutafoto & "\" & Text1.Text & "emp" & ".jpg"
    End If
    
    tabla.Index = "primarykey"
    tabla.Seek "=", Text1.Text
    If tabla.NoMatch Then
        tabla.AddNew
    Else
        tabla.Edit
    End If
    Guardar
    tabla.Update
        MsgBox ("Guardado")
    
    Limpiar
End Sub

Private Sub Command3_Click()
    Cancelar
End Sub

Private Sub Command4_Click()
    Bloquear True
    Text1.Enabled = False
    Text2.SetFocus
    Botones 2
End Sub

Private Sub Command5_Click()
    If MsgBox("Esta seguro de eliminar", vbYesNo) = vbYes Then
        tabla.Delete
        MsgBox "Registro Eliminado"
        Cancelar
    End If
    
End Sub

Private Sub Command6_Click()
    Unload Me
End Sub

Private Sub Command9_Click()
    SendKeys "{TAB}"
End Sub




Private Sub Text1_Validate(Cancel As Boolean)
    Buscar
End Sub

Private Sub Form_Load()
    Cancelar
    Me.Caption = titulo2("Empleados")
    Set tabla = Base.OpenRecordset("Empleados")
End Sub

Private Sub Text7_Change()
    On Error Resume Next
    Image1.Picture = LoadPicture(Text7.Text)
End Sub

Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 114 Then
        cd1.FileName = ""
        cd1.ShowOpen
        Text7.Text = cd1.FileName
        
    End If
        
    
End Sub
